]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Hide separator label when not in use
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 25 May 2014 14:38:05 +0000 (16:38 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 27 May 2014 17:49:04 +0000 (19:49 +0200)
The optional label support introduced in commit af063dc2f2ec broke
the centering of separators, as the label still adds additional
spacing even when empty.
Properly hide the label actor in that case to fix the alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=730753

js/ui/popupMenu.js

index af0d9e19f40ab5bc55de65c1d5ed55813e4426f6..d7f3880c4fce52545a1759b3465d096e7bbf42ab 100644 (file)
@@ -251,8 +251,16 @@ const PopupSeparatorMenuItem = new Lang.Class({
         this.actor.add(this.label);
         this.actor.label_actor = this.label;
 
+        this.label.connect('notify::text',
+                           Lang.bind(this, this._syncVisibility));
+        this._syncVisibility();
+
         this._separator = new Separator.HorizontalSeparator({ style_class: 'popup-separator-menu-item' });
         this.actor.add(this._separator.actor, { expand: true });
+    },
+
+    _syncVisibility: function() {
+        this.label.visible = this.label.text != '';
     }
 });